def dz(n):
    s = 0
    while n > 0:
        s += n % 10
        n //= 10

    return s


def main():
    while True:
        try:
            n = int(input())
            print(dz(n))
        except:
            break


if __name__ == "__main__":
    main()
